package cn.da.shuai.cool.common.entity;

import cn.da.shuai.cool.common.enums.DeletedType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;

@Getter
@Setter
public abstract class EntityBase implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    @Schema(description = "创建时间")
    @TableField("create_time")
    protected LocalDateTime createTime;

    @Schema(description = "创建用户id")
    @TableField("create_By")
    protected Integer createBy;

    @Schema(description = "更新时间")
    @TableField("update_time")
    protected LocalDateTime updateTime;

    @Schema(description = "更新用户id")
    @TableField("update_by")
    protected Integer updateBy;

    @JsonIgnore
    @Schema(description = "删除标准：0未删除 1已删除")
    @TableField("is_deleted")
    @TableLogic(value = "0", delval = "1")
    protected DeletedType isDeleted;
}
